﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SanFranciscoModel.Alumno;
using SanFranciscoModel.Curso;
namespace SanFrancisco
{
    public partial class AlumnoBoletin : Form
    {
        private int _DNI;
        public AlumnoBoletin(int dni)
        {
            _DNI = dni;
            InitializeComponent();
        }

        private void AlumnoBoletin_Load(object sender, EventArgs e)
        {
            AlumnoManager al = new AlumnoManager();
            Alumno Alum = new Alumno();
            Alum = al.getAlumnobyDNI(_DNI);
            
            lblNombre.Text = Alum.Apellido + ' ' + Alum.Nombre;
            lblDNI.Text = Alum.DNIAlumno.ToString();
            
            CursoManager cm = new CursoManager();
            Curso c = new Curso();
            c = cm.getCursoActualbyDNI(_DNI);
            lblCurso.Text = c.NombreCurso;
           
            CargarNotas();
            CargarConducta();
            CargarEstado();
        }

        private void CargarNotas()
        {
            AlumnoDataContext Alumnos = new AlumnoDataContext();
            gridBoletin.AutoGenerateColumns = false;
            gridBoletin.DataSource = Alumnos.AlumnoBoletin(_DNI, DateTime.Now.Year);
        }

        private void CargarConducta()
        {
            AlumnoDataContext Alumno = new AlumnoDataContext();
            gridConducta.AutoGenerateColumns = false;
            gridConducta.DataSource = Alumno.AlumnoBoletinConducta(_DNI,DateTime.Now.Year);
        }

        private void CargarEstado()
        {
            AlumnoDataContext Alumno = new AlumnoDataContext();
            gridConducta.AutoGenerateColumns = false;
            gridEstado.DataSource = Alumno.AlumnoBoletinEstado(_DNI, DateTime.Now.Year);
        }
        private void tabPage1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
